From 5492e81f317e48141b0687ad77252c52c2dfcd6d Mon Sep 17 00:00:00 2001
From: Gustavo Zacarias <gustavo@zacarias.com.ar>
Date: Fri, 5 Feb 2016 19:03:39 -0300
Subject: [PATCH] Make egl conditional

Mesa can be built with GLX and without EGL support, so make this
possible in epoxy as well.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 configure.ac | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6e56599..21e3a25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,6 +58,13 @@ AC_CHECK_HEADER([KHR/khrplatform.h],
 # uintptr_t to a void *") by default.  Kill that.
 XORG_TESTSET_CFLAG(CWARNFLAGS, [-Wno-int-conversion])
 
+AC_ARG_ENABLE([egl],
+		[AS_HELP_STRING([--disable-egl],
+				[disable if you don't want egl support])],
+		[enable_egl=$enableval],
+		[enable_egl=yes]
+             )
+
 AC_ARG_ENABLE([glx],
                 [AS_HELP_STRING([--disable-glx],
 				[disable if you don't want x11/glx support])],
@@ -65,6 +72,7 @@ AC_ARG_ENABLE([glx],
                 [enable_glx=yes]
              )
 
+PKG_CHECK_MODULES(EGL, [egl], [egl=$enable_egl], [egl=no])
 PKG_CHECK_MODULES(X11, [x11], [x11=$enable_glx], [x11=no])
 
 AM_CONDITIONAL(HAVE_X11, test x$x11 = xyes)
@@ -96,7 +104,7 @@ case $host_os in
         EPOXY_LINK_LIBS=""
         ;;
     *)
-        build_egl=yes
+        build_egl=$egl
         build_glx=$x11
         build_wgl=no
         # On platforms with dlopen, we load everything dynamically and
@@ -109,7 +117,6 @@ AC_SUBST(EPOXY_LINK_LIBS)
 
 AM_CONDITIONAL(BUILD_EGL, test x$build_egl = xyes)
 if test x$build_egl = xyes; then
-    PKG_CHECK_MODULES(EGL, [egl])
     AC_DEFINE([BUILD_EGL], [1], [build EGL tests])
 fi
 
-- 
2.4.10

